package torres.item.effect;

import torres.entity.Entity;

/**
 * @author Torres
 *An Effect that increases the health of the specified Entity.
 */
@SuppressWarnings("serial")
public class HealEffect implements Effect {
	int healValue;
	
	
	/**
	 * Create a new HealEffect with the specified value.
	 * @param healValue Amount to heal the player on use.
	 */
	public HealEffect(int healValue) {
		
		this.setHealValue(healValue);
	}
	
	/**
	 * Use this effect on the specified entity.
	 * @param The Entity that is using this item. 
	 */
	@Override
	public void use(Entity e) {
		e.incCurrLife(this.getHealValue());
	}
	
	/**
	 * Tests to see if this effect can successfully be applied to the specified Entity. 
	 * @param e The Entity on which to test if this affect can be applied.
	 * @return True if this effect can be applied to the Entity, false otherwise.
	 */
	public boolean canUse(Entity e) {
		return true;
	}
	
	
	/**
	 * Sets the amount of damage to be recovered on use.
	 * @param healValue The amount of damage to be recovered on use.
	 */
	private void setHealValue(int healValue) {
		
		this.healValue = healValue;
	}
	
	/**
	 * Gets the amount of damage to be recovered on use.
	 * @return The amount of damage to be recovered on use.
	 */ 
	int getHealValue() {
		
		return this.healValue;
	}
}
